import 'package:flutter/material.dart';

import 'index_recommend_data.dart';
import 'index_recommend_item_widget.dart';

class IndexRecomment extends StatelessWidget {
  final List<IndexRecommendItem> dataList;

  const IndexRecomment({Key key, this.dataList = indexRecommendData})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(10.0),
      decoration: BoxDecoration(//背景色
        color: Color(0x08000000),
      ),
      child: Column(
        children: [
          Row(

            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text('房屋推荐', style: TextStyle(fontWeight: FontWeight.w600)),
              Text('更多', style: TextStyle(fontWeight: FontWeight.w300)),
            ],
          ),
          Padding(padding: EdgeInsets.all(5)),
          Wrap(
              runSpacing: 10.0,//换行的时候行之间的间距
              spacing: 10.0,//两个水平item之间的间距
              children: dataList
                  .map((item) => IndexRecommendItemWidget(item))
                  .toList()),
        ],
      ),
    );
  }
}
